<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/mytags.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file="/common/jquery.jsp"%>
<%@ include file="/common/jquery-zTree.jsp"%>
<script type="text/javascript">
	var setting = {
		data: {
			simpleData: {
				enable: true
			}
		}
	};
	var zNodes=[
		{id:1, pId:0, name: "父节点1"},
		{id:11, pId:1, name: "子节点1"},
		{id:12, pId:1, name: "子节点2"}
	];
	
	$(document).ready(function(){
		$.fn.zTree.init($("#treeInfo"), setting, zNodes);
		var zTree = $.fn.zTree.getZTreeObj("treeInfo");
		<c:if test="${not empty param.name}">
			var node = zTree.getNodeByParam("id", "${param.name}");
			zTree.selectNode(node,false);
		</c:if>	
		$("#expandAllBtn").bind("click", {type:"expandAll"}, function(e){zTree.expandAll(true)});
		$("#collapseAllBtn").bind("click", {type:"collapseAll"}, function(e){zTree.expandAll(false)});
	});
</script>
</head>
<body>
	<div align="center">
		<a id="expandAllBtn" href="#" onclick="return false;">展开</a>
		<a id="collapseAllBtn" href="#" onclick="return false;">折叠</a>
	</div>
	<ul id="treeInfo" class="ztree"></ul>
</body>
</html>